<?php
include_once 'Panel/Password.php';
class NewPasswordController extends PasswordController{
	private $status;
	protected $user;
	
	function __construct(){
		$this->status = 'form';
	}
	
	public function indexAction($params=null){
		tools::_assign('status',$this->status);
		tools::_display("section/const_nowe_haslo.tpl");

	}
	
	public function generujAction($params=null){
		global $config;
		$haslo = $this->GenerujHasloAction();
		$this->user = new UserController();
		$this->user->byuseremailAction($config->email);
		$this->user->md5_haslo = md5($haslo);
		
		$this->status = 'tresc_meila';
		tools::_assign('status',$this->status);		
		tools::_assign('user',$this->user->all);
		tools::_assign('haslo',$haslo);		
		$tresc = tools::_fetch("section/const_nowe_haslo.tpl");
		$this->status = (tools::__wiadomosc("{$this->user->imie} {$this->user->nazwisko}",$this->user->email,$this->user->email,"Wygenerowanie nowego hasła",$tresc,"txt",false)) ? "ok" : "error";	
			
	}
}
?>